package com.atguigu1.core.rdd

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
 *
 * @description: xxx
 * @time: 2021-03-12 11:45
 * @author: baojinlong
 **/
object Spark01RddMemory {
  def main(args: Array[String]): Unit = {
    val sparkConf: SparkConf = new SparkConf().setMaster("local[*]").setAppName("rdd")
    val sparkContext = new SparkContext(sparkConf)
    // 从内容村中创建Rdd,将内存中集合的数据作为处理的数据源
    val intsSeq: Seq[Int] = Seq[Int](1, 2, 3, 4)
    //val value: RDD[Int] = sparkContext.parallelize(intsSeq)
    val value: RDD[Int] = sparkContext.makeRDD(intsSeq)
    value.collect().foreach(println)
    // 关闭环境
    sparkContext.stop()
  }

}
